<?php

/*
 +-------------------------------------------------------------------+
 |                   builder.ctl.php                                 |
 |                                                                   |
 | Copyright ?                          www.gde.sclab.clarkson.edu   |
 | Author: Demetrios Dimatos            www.dimatos.net              |
 | Created: August 2006                 Last modified: Oct 15, 2006  |
 +-------------------------------------------------------------------+
 | This is the control file for builder.php that contains all the    |
 | logic.                                                            |
 |  - /gde-1.0/templates/logged-in/builder.php                       |
 |  - /gde-1.0/templates/logged-in/builder-1.php                     |
 |  - /gde-1.0/templates/logged-in/builder-2.php                     |
 |  - /gde-1.0/templates/logged-in/builder-3.php                     |                    |
 +-------------------------------------------------------------------+
*/

 //Start the SESSION vars
 if (session_id() == "")
 { 
 	 session_start();
 }
 // Include configuration variables
 include_once('/var/www/gde-1.0/htdocs/config.php');
 // Include builder functions
 include_once(Config::base_path.Config::builder_func_path."builder.func.php");
 // Include html functions
 include_once(Config::base_path.Config::html_func_path."html.php");
 
 
 // No database choice is made to build query.
 if( !isset($_SESSION['selected_database']))
 {
   $_SESSION['selected_database'] = "place_holder";
   buiildDatabaseQuery();
 }
 else  //Database selection was made and is set.
 {
   if(!isset($_SESSION['selected_table']))
   { 
      $_SESSION['selected_database'] = $_POST['selected_database'];
      echo "User Selected Database ".$_SESSION['selected_database'];
      $_SESSION['selected_table'] = "place_holder";
      buiildTableQuery($_SESSION['selected_database']);
   }
   else
   {
     if(!isset($_SESSION['selected_fields']))
     {
        $_SESSION['selected_table'] = $_POST['selected_table'];  
        echo "User Selected Table ".$_SESSION['selected_table'];
     }
     else 
     {
       
     }
   }
 }
 ?>